<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>z轴平移</title>
    <style>
        html{
            /*perspective设置当期网页的视距为800px，人眼距离网页的距离*/
            perspective: 800px;
        }
        body{
            border:1px black solid;
            background-color: rgb(241,241,241);
        }
        .box1{
            width:200px;
            height:200px;
            background-color: aqua;
            margin:200px auto;
            transition: 2s;
        }
        body:hover .box1{
            transform: translateZ(-200px);
        }
    </style>
</head>
<body>
    <div class="box1"></div>
</body>
</html>